package com.uobgroup.ews.uam.core.dao;

import java.util.List;

import com.uobgroup.ews.uam.core.domain.Reference;
import com.uobgroup.ews.uam.core.domain.ReferenceType;
import com.uobgroup.ews.uam.core.domain.Segment;
import com.uobgroup.ews.uam.core.enums.ScopeType;

public interface ReferenceDao extends GenericDao<Reference> {

   public long count();

   public List<Reference> findAll(int firstResult, int maxResults);

   public List<Reference> findAllReferencesByType(ReferenceType referenceType);
   
   /*
    * DongN
    */
   
   public Reference findReferencesByType(ReferenceType referenceType);
   
   public List<ReferenceType> findReferenceTypesThatHasReferencesByScope(ScopeType scope);
   
   public long countReferencesByType(ReferenceType referenceType);
   
   public List<Reference> findReferencesByType(ReferenceType referenceType, int firstResult, int maxResults);
   
   public List<Reference> findReferencesByReferenceTypeScope(ScopeType scope, int firstResult, int maxResults);
   
   public long countReferencesByReferenceTypeScope(ScopeType scope);
   
   public Reference findReferenceByName(String name);
   
   public Reference findReferenceThatHasNameAndNotHasId(String name, Long id);
   
   public Reference findReferenceThatHasCodeAndNotHasId(String code, Long id);
   
   public Reference findReferenceByCode(String code);
   
   public Reference findReferenceByIdAndScope(Long id, ScopeType scope);
   
   /*
    * DongN
    */
   
  // public Reference findFirstReferencesByType(ReferenceType processingCenter);

   public Segment findSegment(Long id);

   public List<Segment> findSegmentEntries(int firstResult, int sizeNo);

   public float countSegments();

   public List<Segment> findAllSegments();

   public void removeSegment(Segment segment);

   public List<Reference> findAllReferencesThatHasNoSegment(ReferenceType segmentType);
   
   public List<Reference> findSegmentReferencesByName(String name);
   
   
   public Segment findSegmentByRefId(Long id);
   
   public void addSegment(Segment segment);
   /**
    * @author dongn
    */
   public long countSegmentsThatHasSegmentReference(Reference segment);
   
}
